function gradioCustom() {
  function copy2clipboard(text) {
    // Check if Clipboard API is available
    if (navigator.clipboard && window.isSecureContext) {
      return navigator.clipboard.writeText(text)
        .then(() => console.log("Text copied to clipboard"))
        .catch((error) => console.error("Error copying text to clipboard:", error));
    }

    // Fallback to older execCommand method for non-secure connections or incompatible browsers
    var textArea = document.createElement("textarea");
    textArea.value = text;

    // Make sure the textarea is not displayed on the page
    textArea.style.position = "fixed";
    textArea.style.top = "-9999px";
    textArea.style.left = "-9999px";

    document.body.appendChild(textArea);
    textArea.focus();
    textArea.select();

    try {
      // Execute the 'copy' command
      var successful = document.execCommand('copy');
      var message = successful ? "Text copied to clipboard" : "Unable to copy text to clipboard";
      console.log(message);
    } catch (error) {
      console.error("Error copying text to clipboard:", error);
    }

    document.body.removeChild(textArea);
  }

  function copyGenToClipboard() {
    const genText = document.querySelector('#gen textarea').value;
    copy2clipboard(genText);
  }

  console.log("Adding copy event listener");
  document.querySelector('#copy-btn').addEventListener('click', copyGenToClipboard);
}